import 'package:flutter/material.dart';

import '../../../theme/theme_color.dart';

class paySucDialog extends Dialog {

  const paySucDialog({super.key});

  @override
  Widget build(BuildContext context) {
    double _width = MediaQuery.of(context).size.width;

    return Center(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Container(
            width: 270,
            height: 278,

            // margin: const EdgeInsets.only(left: 0, right: 0, bottom: 0),
            color: Colors.transparent,
            child: Container(
              height: 280,
              decoration: ShapeDecoration(
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(15),
                ),
                color:Colors.white,
              ),
              child: Column(
                children: [
                  const SizedBox(height: 27,),
                  Image.asset(
                    'images/ic_paySucM.png',
                    width: 108,
                    height: 108,
                    fit: BoxFit.cover,
                  ),
                  const SizedBox(height: 10,),
                  const Text('支付成功',
                      style: TextStyle(
                          fontSize: 16,
                          color: Colors.grey,
                          decoration: TextDecoration.none)
                  ),

                  const SizedBox(height: 10,),
                  GestureDetector(
                    child: Container(
                        margin:  const EdgeInsets.fromLTRB(59, 15, 59, 0),
                        height: 45,
                        decoration: ShapeDecoration(
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(22.5)),
                          color:  ThemeColor.greenColor,
                        ),
                        width: double.maxFinite,
                        child:  const Center(
                          child: Text(
                            "我知道了",
                            style: TextStyle(
                              color: Colors.white,
                              fontSize: 18,
                            ),
                          ),
                        )
                    ),
                  ),
                ],
              ),
            ),
          ),
          const SizedBox(height: 30,),
          GestureDetector(
            onTap: (){
              Navigator.pop(context);
            },
            child: Image.asset(
              'images/ic_closeM.png',
              width: 24,
              height: 24,
              fit: BoxFit.cover,
            ),
          )
        ],
      ),
    );
  }

  static showPayDialog(
      BuildContext context) {
    return showDialog(
        barrierDismissible: false,
        context: context,
        builder: (BuildContext context) {
          return const WillPopScope(
              child: paySucDialog(),onWillPop: _onWillPop);
        });
  }

  static Future<bool> _onWillPop() async{
    return false;
  }
}
